<?php 

class App_Model_DbTable_Article_Type_Music extends Ext_Db_Table  
{  
    protected $_name = 'article_type_music';
    
	public function get($id)
	{
		if(!$id)
		{
			return "";
		}
		
		$db = $this->getAdapter();
		$safe = $db->quoteInto(" id = ? ", $id);
		$row = $this->fetchRow($safe);
		if (!$row) {
			//throw new Exception("Count not find row $id");
			return "";
		}
		return $row->toArray();
	}
	
	public function addNew($inputArray)
	{
		$sql_data_array = array();
		if(array_key_exists('id', $inputArray)) $sql_data_array['id'] = $inputArray['id'];
		if(array_key_exists('ids', $inputArray)) $sql_data_array['ids'] = $inputArray['ids'];
		
		try {
			$rows_affected = $this->insert($sql_data_array);
		}catch (Exception $e){
			trigger_error($e->getMessage(), E_USER_WARNING);
		}
		
		return "";
	}
	
	public function addOld($inputArray, $articleId)
	{
		$articleId = intval($articleId);
		
		$sql_data_array = array();
		if(array_key_exists('ids', $inputArray)) $sql_data_array['ids'] = $inputArray['ids'];
				
		try {
			$db = $this->getAdapter();
			$where = $db->quoteInto(" id = ? ", $articleId);
			$rows_affected = $this->update($sql_data_array, $where);
		}catch (Exception $e){
			trigger_error($e->getMessage(), E_USER_WARNING);
		}
		
		return "";
	}
}